///////////////////////////////////////////////////////////////////////////////
// Name:        data.cpp
// Purpose:     data
// Copyright:   (c) 2006, Ivan Laptev, TT Solutions
// License:     GPL, Please contact us for commercial license.
//              http://www.tt-solutions.com/
///////////////////////////////////////////////////////////////////////////////
#include "objectdet/data.h"

#include "objectdet/xmlloadmodel.h"

#include <utility>
#include <string>

using namespace std;

IMPEXP
boost::tuple<pMat, pMat, pMat> ReadTextons(string const & texton_xml_file)
{
    pFileStorage tfsr = OpenFileStorage(texton_xml_file, RWM_Read);

    // if we dont clone matrices then upon the release of the file storage,
    // matrices are disposed(!) too
    pMat cmeans = CloneMat(ReadMatrixFromFile(tfsr, "cmeans"));
    pMat covmat = CloneMat(ReadMatrixFromFile(tfsr, "sqrtinvcovmat"));
    pMat cmeansnorm = CloneMat(ReadMatrixFromFile(tfsr, "cmeansnorm"));
    return boost::make_tuple(cmeans, covmat, cmeansnorm);
}
